Skip to content

[Backport release/3.0.0] Fix sensor timing drift while preserving compatibility - #9055

Merged
AntoineRichard merged 2 commits into
isaac-sim:release/3.0.0from
kellyguo11:codex/backport-8160-release-3.0.0
Nov 18, 2026
Merged

AntoineRichard merged 2 commits into
isaac-sim:release/3.0.0from
kellyguo11:codex/backport-8160-release-3.0.0

Conversation

@kellyguo11

@kellyguo11 kellyguo11 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes sensor refreshes being delayed by float32 clock rounding on release/3.0.0, adapting #8160 while preserving the release branch's existing timing interfaces. With dt=0.005 and update_period=0.02, the original scheduler can skip otherwise-due refreshes from about 16 s into an episode.

Sensor scheduling and the built-in PhysX, Newton, and OVPhysX contact sensors now use float64 elapsed time accumulated since the last actual refresh. The original float32 timestamps retain their meaning.

Related: #8159. The first commit cherry-picks #8160; the follow-up adds release compatibility.

Release compatibility

  • Preserved the existing scheduler and backend contact Warp kernel names, argument order, and dtypes. Existing direct callers retain their timestamp-based timing behavior. Built-in sensors use new *_elapsed_kernel entry points for the precision fix.
  • Shared each backend's force/history/transition implementation between its old and new entry points.
  • Custom sensors that allocate or replace their own timestamp buffers automatically acquire elapsed-time tracking on first use, including after resizing. No call to the new timing allocator is required. The normal update path adds no allocation or extra kernel launch for compatibility; adopting replacement buffers initializes the elapsed buffer once.
  • Removed the original breaking-change fragment and major-bump marker; retained fix fragments for all four packages.

Validation

On the final implementation, using the worktree's isolated CPU environment with Warp 1.17.0 and Torch 2.11.0:

  • test_sensor_update_schedule.py: 3 passed, 2 CUDA-only cases skipped. The two skipped lazy-read and variable-dt scenarios were also invoked directly on CPU and passed.
  • test_contact_timing_kernels.py: 3 passed; exercises both old and new entry points for PhysX, Newton, and OVPhysX, asserting timing, transitions, force history, and masking.
  • test_contact_sensor_history.py (Newton): 2 passed using its original timestamp-based kernel signature.
  • test_simulation_render_context.py: 27 passed (existing Torch JIT deprecation warnings).
  • The five compatibility regressions fail against the preceding PR implementation for the expected missing-buffer or kernel-signature errors, and pass with the follow-up.
  • All repository pre-commit hooks passed via uv run --no-project --with pre-commit pre-commit run --all-files, with the changelog gate targeting the release base. git diff --check passed.
  • Verified all six original kernel signatures against the release base and checked that extracting shared contact processing preserved force/history/transition operations.

The standard project synchronization is unsupported on macOS, so focused tests ran with uv run --no-sync and explicit workspace source paths. Full simulator/GPU runs, CUDA graph capture, and GPU performance have not been validated for this revision.

Type of change

  • Bug fix (non-breaking change)

# Description

The sensor scheduler decides whether a sensor is due by subtracting two
float32 per-env timestamps (`timestamp - timestamp_last_update + 1e-6 >=
update_period` in `update_timestamp_kernel`). Both grow with the time
since the env's last reset. As they grow, float32 rounding of the
repeated `timestamp + dt` makes the computed elapsed time fall below
`update_period - 1e-6`, so otherwise-due refreshes are delayed by one or
more updates, and a lazily read sensor returns its previous data. With
`dt = 0.005` and `update_period = 0.02` this starts at t = 16.02 s; with
long periods at small `dt` it starts within the first seconds.

Reproduction (CPU only, the script in isaac-sim#8159): develop prints `stale
reads: 100 / 1000; first at t = [16.02] s`; this branch prints `stale
reads: 0 / 1000`.

The fix:

- adds a private per-env buffer `_elapsed_since_update` (float64): the
time since the last refresh, accumulated from zero and restarted at
every actual refresh and every reset;
- uses it only for the due-ness decision: `elapsed >= update_period -
1e-6`;
- keeps `_timestamp` / `_timestamp_last_update` bitwise unchanged (`dt`
is passed as float64 and cast to float32 for the timestamp; PhysX and
OVPhysX still read `timestamp` for the `timestamp == 0` reset guard);
- advances the contact sensors' air/contact times (PhysX, Newton,
OVPhysX) by the same `_elapsed_since_update` instead of `timestamp -
timestamp_last_update`, so nothing subtracts the growing float32
timestamps any more;
- preserves the scheduling semantics: the period is counted from the
actual refresh (not a fixed time grid), lazy reads shift the phase, a
due sensor stays due until read, `update_period = 0` refreshes on every
read, `dt` may vary between calls, and a reset still marks the env
outdated;
- changes no public API or config; the private timing buffers are
allocated by a new `SensorBase._create_timing_buffers()`.

The elapsed value is bounded by the update period plus the time a due
sensor waits to be read, so its rounding error no longer depends on how
long the episode has run.

`SensorBase._create_timing_buffers()` allocates the env masks,
timestamps, outdated flags and the new buffer for the current
`_num_envs`. `_initialize_impl()` and the three `isaaclab_ov` sensors
that change `_num_envs` after initialization (contact sensor, frame
transformer, joint wrench sensor) call it instead of rebuilding the
buffers, and so do the two hand-built fake sensors in
`test_simulation_render_context.py`.

Breaking: a sensor that allocates or resizes the timing buffers itself
instead of calling `SensorBase._initialize_impl()` or
`_create_timing_buffers()` fails with `AttributeError:
'_elapsed_since_update'` on its first `update()`, and code that launches
the changed Warp kernels directly must pass the new buffer. Both are
covered in the `isaaclab` changelog.

Related: isaac-sim#7283 / isaac-sim#7574 made `compute_first_contact()` /
`compute_first_air()` robust to the same float32 clock error by
defaulting their tolerance to half the sensor update interval. With the
air/contact times now advanced by the float64 elapsed time, their error
no longer grows with the clock (kernel-level check below). The
half-interval default is kept: even with exact timers, a fixed `1e-8`
tolerance is below the float32 resolution of the timer for periods of
0.2 s and more (`float32(0.2 + 1e-8) == float32(0.2)`), so it still
misses every transition there.

Fixes isaac-sim#8159

## Type of change

- Breaking change (existing functionality will not work without user
modification)

## Release backport

- [ ] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable. Evidence:

| Validation | develop | this PR |
| --- | ---: | ---: |
| Scheduler tests (`test_sensor_update_schedule.py`, 4 cases) | 3 fail /
1 pass | 4 / 4 pass |
| Contact kernels of PhysX, Newton and OVPhysX, 40 s against an exact
model (CPU + CUDA, substep and lazy refresh, resets): max air/contact
time error | 7.7e-5 s | 3.9e-8 s |
| Same, missed first-contact/first-air with a fixed `abs_tol=1e-8`
(default half-interval tolerance: 0 on both) | up to 34,772 of 60,085 |
0 (no false positives) |
| Reproducer in isaac-sim#8159, stale reads | 100 / 1000 | 0 / 1000 |
| Isaac-Velocity-Rough-UnitreeGo2, Isaac Sim PhysX, 8 envs, 20 s, stale
height-scan reads | 465 | 0 |
| Same task, Newton with `use_newton_actuators=False`, 20 s | 700 | 0 |
| Same task, Newton default preset, 20 s (one `update(step_dt)` per
step, not exposed in 20 s) | 0 | 0 |
| Same task, Newton default preset, 70 s | 1200 | 0 |
| IMU / FrameTransformer / ContactSensor (history 0) / Newton Warp
camera at `update_period = step_dt`, 70 s, stale reads each | 4400 | 0 |
| Scheduler stress, real `SensorBase`, up to 200,000 simulated s,
periods 1 to 1000 steps and non-integer, variable `dt`, 4096 envs with
random resets | early and late refreshes | 0 early / late / missed |

The aged-clock and variable-`dt` cases fail on develop at the first
delayed refresh. The case that passes on develop (an unread due sensor
stays due until read) guards the scheduling semantics: it fails under
fixed-grid scheduling, and the variable-`dt` case is the only one that
fails when updates are counted instead of timed (checked by mutating the
patched code).

Performance (desktop GPU shared with another job; alternating develop/PR
processes; bootstrap 95% CI): the scheduler kernels cost slightly more
(+30 to 160 ns device time per step, 1 to 8192 envs), and no
statistically meaningful whole-environment step-time change was observed
up to 8192 envs on the task above with the Newton default preset and
with `use_newton_actuators=False` (e.g. 8192 envs: 101.1 vs 100.4 ms and
102.5 vs 102.9 ms per step, CIs include 0). Memory: +8 bytes per env per
sensor.

Not runtime-validated: the `_create_timing_buffers()` calls in the three
`isaaclab_ov` resize branches (the OVPhysX sensor tests pass on CPU and
CUDA, but their scenes never take the `binding count != _num_envs`
branch), Kit RTX cameras, PhysX-path performance, and torch 2.12 (runs
used torch 2.11 + CUDA 12.8; the changed code path is Warp only). The
performance numbers above are from the scheduler change; the contact
kernels now read one float64 per env instead of two float32 timestamps.

Tests run locally on this branch (base 09b1d54):
`test_sensor_update_schedule.py`, `test_simulation_render_context.py`,
`test_simulation_context.py`, `test_sensor_base.py`,
`test_outdated_sensor.py`; Newton `test_contact_sensor.py` (including
the isaac-sim#7574 aged-clock cases) / `test_contact_sensor_history.py` /
`test_imu.py` / `test_pva.py` / `test_frame_transformer.py`; PhysX
(Isaac Sim) `test_contact_sensor.py` / `test_imu_pva_recorded_launch.py`
/ `test_joint_wrench_sensor.py`; OVPhysX (`ovphysx==0.6.3`, one run per
device) `test_contact_sensor.py` / `test_contact_sensor_kernels.py` /
`test_frame_transformer.py` / `test_joint_wrench_sensor.py` /
`test_imu.py` / `test_pva.py`. All pass.

## Checklist

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab --format`
- [ ] I have made corresponding changes to the documentation (no public
API or documented behavior changes; the private-buffer change is
described in the changelog)
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the [test-audit
criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md)
to any test changes
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions: CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Yusuf Guenena <yusuf.a.guenena@gmail.com>
(cherry picked from commit 32a1f33)
@kellyguo11

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 17, 2026

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Compatibility and deprecation (2), Style consistency (6), Test quality (4). Other reviewed categories look good.

  • PR description: The title matches the diff and validation limits are explicit; clarify float32 contact timers and benchmark per-step float64 scheduling using baseline/candidate revisions, command, hardware, backend, environment count, warmup, latency, and memory.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: legacy kernel launches and custom timing-buffer allocation fail without functional bridges; add targeted warnings, migration and removal guidance, and transition coverage before retiring either contract.
  • Implementation: Implementation looks good.
  • Style consistency: Migration and backend changelog prose misdescribe timestamp subtraction and timer precision; correct those contracts and remove redundant implementation narration.
  • Test quality: Identical environment and device replays duplicate scheduling proof; reduce them, shorten sibling runs, and make variable-dt inputs produce an irregular refresh cadence.

Significant concerns. Posted 12 inline findings.

Automated review; human maintainers own approval decisions.

@@ -0,0 +1,6 @@
* **Breaking:** Added a float64 ``_elapsed_since_update`` buffer to the timing state of
:class:`~isaaclab.sensors.SensorBase` and passed it to the ``update_timestamp_kernel``,
``update_outdated_envs_kernel`` and ``reset_envs_kernel`` kernels in place of the float32 timestamps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Correct the kernel migration note

Only update_timestamp_kernel formerly subtracted timestamps; the other two kernels did not. Describe their new elapsed-buffer arguments separately so the migration note identifies the changed contract accurately.

timestamp_last_update: wp.array(dtype=wp.float32),
dt: wp.float32,
update_period: wp.float32,
elapsed_since_update: wp.array(dtype=wp.float64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Keep legacy kernel launch contracts

Existing direct launches of the three timing and three backend contact kernels reject old argument counts or dtypes. Keep legacy entry points functional through deprecation, with targeted warnings, migration guidance, and old/new validation.

is_outdated: Boolean array indicating which envs need update. Will be set to False.
timestamp: Current timestamp per env.
timestamp_last_update: Last update timestamp per env. Will be set to current timestamp.
elapsed_since_update: Time since the last refresh per env. Will be set to 0.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — State elapsed-buffer units

The refresh and reset kernel docstrings omit seconds for the new elapsed-time argument, unlike the scheduling and backend descriptions. Add [s] to both.

Sensors that change :attr:`_num_envs` after :meth:`_initialize_impl` must call this again, after
reallocating their environment masks.
"""
# timestamp and outdated flags

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Remove the stale allocation comment

The comment names only timestamps and outdated flags, omitting the new elapsed buffer, and merely narrates the assignments. Remove it.

self._is_outdated = wp.ones(self._num_envs, dtype=wp.bool, device=self._device)
self._timestamp = wp.zeros(self._num_envs, dtype=wp.float32, device=self._device)
self._timestamp_last_update = wp.zeros_like(self._timestamp)
self._elapsed_since_update = wp.zeros(self._num_envs, dtype=wp.float64, device=self._device)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Bridge custom timing-buffer allocation

Custom sensors allocating or resizing the former timing buffers leave this new buffer absent or incorrectly sized, breaking subsequent launches. Support that path during deprecation and warn callers to use _create_timing_buffers().



def _run(sensor: _RefreshLogSensor, dts: list[float], read_every: int = 1) -> list[list[int]]:
"""Calls ``update(dt)`` for each step and reads the data every ``read_every`` steps."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Remove the loop-narrating docstring

The helper docstring repeats its update loop and read interval without explaining a constraint. Remove it or describe a non-obvious observable contract.

return sensor.refreshes


@pytest.mark.parametrize("device", test_devices(DeviceScope.CPU_AND_DEFAULT_CUDA))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Remove the duplicate device replay

CPU and CUDA exercise the same scheduling kernel and Python path with identical assertions. This second 4,000-step replay adds cost without a distinct contract; keep one scoped device.

"""The period restarts at the read that refreshed the sensor, not on a fixed time grid."""
# reads every 3 steps leave a 4-step sensor due and unread for 2 steps, so it refreshes every 6 steps
sensor = _RefreshLogSensor(update_period=0.02, device=device)
refreshes = _run(sensor, [0.005] * 4000, read_every=3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Shorten the sibling schedule runs

Unread rephasing needs only a few reads; this 4,000-step run and the variable-dt run repeat aging already owned by the cadence test. Shorten both to their distinct observable behavior.

def test_refresh_follows_the_time_passed_to_update(device):
"""The period is measured in the ``dt`` passed to each update, not in a number of updates."""
sensor = _RefreshLogSensor(update_period=0.02, device=device)
refreshes = _run(sensor, [0.005, 0.015] * 2000)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Make variable dt observable

Alternating 0.005 and 0.015 seconds still produces a refresh every two steps, so this assertion cannot distinguish elapsed-time scheduling from counting updates. Use intervals that produce a different step cadence.

@@ -0,0 +1,3 @@
* Fixed the air and contact times of :class:`~isaaclab_physx.sensors.ContactSensor` drifting with the age of the
sensor clock. Each refresh added the difference of two growing float32 timestamps, which was off by up to 8e-5 s
after 40 s of simulated time. It now adds the float64 time since the last refresh kept by the sensor base class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Describe contact-timer precision accurately

All three backend kernels cast elapsed time to float32 before adding it to float32 timers. Correct the PhysX, Newton, and OVPhysX fragments; the timers do not add a float64 value.

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches shared sensor scheduling and contact timing across three physics backends.

The PR appears safe to merge; the remaining test improvement is non-blocking.

Findings

  1. P2 Contact timer fix lacks coverage ▶

Summary

This backport uses float64 elapsed time to keep sensor refreshes and contact timers steady as simulations age.

  • Sensor refreshes stay on schedule as simulation clocks age.
  • Contact sensors track air and contact times with elapsed simulation time.

kellyguo11 explicitly acknowledges the private timing-buffer and kernel API changes as intentional and documents the migration. No blocking defects were found; one focused test improvement is recommended.

Reviews (1) · Last reviewed commit: "Fix sensor refreshes delayed by float32 ..." · Reviewed by Greptile

data.create_buffers(2, 1, 1, 3, True, False, False, "cpu", track_friction_forces=True)
timestamp = wp.ones((2,), dtype=wp.float32, device="cpu")
timestamp_last_update = wp.zeros((2,), dtype=wp.float32, device="cpu")
elapsed_since_update = wp.ones((2,), dtype=wp.float64, device="cpu")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Contact timer fix lacks coverage. This test supplies the new elapsed-time buffer but still passes None for all four air/contact timers. It therefore never runs the changed timer calculation. The new schedule tests exercise only SensorBase.

Add a focused kernel test with timer buffers and a small elapsed interval. Check the resulting air/contact times, including a masked environment. This would catch a wrong interval or a missed argument change without starting a simulation.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Compatibility and deprecation (5), Style consistency (7), Test quality (2). Other reviewed categories look good.

  • PR description: The title and backend scope match the diff, and blocked runtime validation is disclosed; expand Compatibility to explain due_threshold = update_period - 1e-6 and the required deprecation transition.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: custom timing-buffer allocation and core, Newton, PhysX, and OVPhysX kernel launches lose their old contracts; retain functional bridges with targeted warnings, migration/removal guidance, and transition tests.
  • Implementation: Implementation looks good.
  • Style consistency: Migration fragments misdescribe prior kernel behavior and contact-timer precision; distinguish elapsed accumulation from float32 timer addition and describe each kernel’s actual responsibility.
  • Test quality: The CPU cadence replay and long unread/variable-dt sequences repeat scheduling coverage and GPU readbacks; retain one cadence device and shorten the distinct non-aging cases.

Significant concerns. Posted 14 inline findings.

Automated review; human maintainers own approval decisions.

@@ -0,0 +1,6 @@
* **Breaking:** Added a float64 ``_elapsed_since_update`` buffer to the timing state of
:class:`~isaaclab.sensors.SensorBase` and passed it to the ``update_timestamp_kernel``,
``update_outdated_envs_kernel`` and ``reset_envs_kernel`` kernels in place of the float32 timestamps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Correct the kernel migration description

This says all three kernels formerly subtracted float32 timestamps; only the due-check kernel did. State that the other two now clear the elapsed buffer, so migration guidance matches their behavior.

timestamp_last_update: wp.array(dtype=wp.float32),
dt: wp.float32,
update_period: wp.float32,
elapsed_since_update: wp.array(dtype=wp.float64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve timing kernel launch contracts

Existing launches of the three timing kernels now fail argument validation or pass an update period where a due threshold is expected. Retain legacy entry points during a warned migration and validate both forms.

is_outdated: Boolean array indicating which envs need update. Will be set to False.
timestamp: Current timestamp per env.
timestamp_last_update: Last update timestamp per env. Will be set to current timestamp.
elapsed_since_update: Time since the last refresh per env. Will be set to 0.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Document elapsed-buffer units and shape

The new refresh and reset kernel arguments omit the elapsed array’s units and shape. Document seconds and the per-environment shape at both declarations, as the contribution guide requires.

inputs=[
self._is_outdated,
self._timestamp,
self._elapsed_since_update,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Bridge custom timing-buffer allocation

Custom sensors allocating or resizing the former timing arrays now lack a correctly sized elapsed buffer, breaking update and reset. Keep that path functional during a warned, documented migration and validate both paths.

Sensors that change :attr:`_num_envs` after :meth:`_initialize_impl` must call this again, after
reallocating their environment masks.
"""
# timestamp and outdated flags

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Remove the allocation narration

The comment merely labels the following assignments, repeats the method summary, and omits the new elapsed buffer. Delete it.

"""The period restarts at the read that refreshed the sensor, not on a fixed time grid."""
# reads every 3 steps leave a 4-step sensor due and unread for 2 steps, so it refreshes every 6 steps
sensor = _RefreshLogSensor(update_period=0.02, device=device)
refreshes = _run(sensor, [0.005] * 4000, read_every=3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Shorten non-aging schedule tests

Unread and variable-dt behavior needs only a few refreshes; each 4,000-step run repeats the aged-clock test’s cost and GPU readbacks. Shorten both sequences and their expected lists.

@@ -0,0 +1,3 @@
* Fixed the air and contact times of :class:`~isaaclab_newton.sensors.ContactSensor` drifting with the age of the
sensor clock. Each refresh added the difference of two growing float32 timestamps, which was off by up to 8e-5 s
after 40 s of simulated time. It now adds the float64 time since the last refresh kept by the sensor base class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Describe contact-timer precision accurately

This and the PhysX and OVPhysX fragments say timers add float64 time, but all three kernels cast elapsed time to float32 before addition. Describe float64 elapsed accumulation followed by conversion.

friction_force_matrix: wp.array3d(dtype=wp.vec3f),
timestamp: wp.array(dtype=wp.float32),
timestamp_last_update: wp.array(dtype=wp.float32),
elapsed_since_update: wp.array(dtype=wp.float64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve Newton contact kernel launches

Direct launches with the former timestamp pair now have the wrong arity and dtype. Retain a functional legacy entry point alongside the elapsed-buffer variant, with migration warning and transition coverage.

contact_force_threshold: wp.float32,
timestamp: wp.array(dtype=wp.float32),
timestamp_last_update: wp.array(dtype=wp.float32),
elapsed_since_update: wp.array(dtype=wp.float64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve OVPhysX contact kernel launches

Direct launches supplying the former float32 last-update array now fail dtype validation. Retain the legacy launch contract alongside the elapsed-buffer variant, with migration warning and transition coverage.

contact_force_threshold: wp.float32,
timestamp: wp.array(dtype=wp.float32),
timestamp_last_update: wp.array(dtype=wp.float32),
elapsed_since_update: wp.array(dtype=wp.float64),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve PhysX contact kernel launches

Direct launches supplying the former float32 last-update array now fail dtype validation. Retain the legacy launch contract alongside the elapsed-buffer variant, with migration warning and transition coverage.

@kellyguo11 kellyguo11 changed the title [Backport release/3.0.0] Fix sensor refreshes delayed by float32 clock rounding [Backport release/3.0.0] Fix sensor timing drift while preserving compatibility Nov 17, 2026
@kellyguo11

Copy link
Copy Markdown
Contributor Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 17, 2026

@maxkra15 maxkra15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing timing interfaces are preserved, and the scheduler and contact tests passed in release CI.

@AntoineRichard
AntoineRichard merged commit 3dd3aa0 into isaac-sim:release/3.0.0 Nov 18, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants